package com.example.demo.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.example.demo.pojo.Song;
import com.example.demo.service.SongService;






@Controller
@RequestMapping("/song")
public class SongAction {
	@Autowired
	SongService songService;
	
	@RequestMapping("/getSongList")
	public String getSingerList(Model model) {
		List<Song> songList=songService.getSongList();
		model.addAttribute("songList", songList);
		return "";
	}
	
	
	@RequestMapping("/updateSong")
	public String updateSong(Song song,Model model) {
		boolean f=songService.updateSong(song);
		if(f) {
			model.addAttribute("result","yes");
			model.addAttribute("msg","恭喜您，修改成功");
		}
		else {
			model.addAttribute("result","no");
			model.addAttribute("msg","对不起，修改失败");
		}
		return "";
	}

}
